package myTest;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

@Slf4j
public class LowBitTest {

    @Test
    public void testLowBit() {

        int num = 88;
        log.info("{} 的lowBit: {}", num, num & (-num));

        int temp = num;
        log.info("{} 中二进制下所有位是1的数值如下", num);
        while (temp > 0) {
            int lowBit = temp & (-temp);
            log.info(">> {} ", lowBit);
            temp = temp - lowBit;
        }

        System.out.println(3 + (3 & -3));

    }
}
